from configparser import *

class reader:
    def __init__(self):
        self.base = {}
        self.word = {}
        word_TS = {}#临时

        conf = ConfigParser()
        conf.read("./config.cfg")
        self.exe_language = conf.get("base","exe_language")
        self.all_language = conf.get("base","all_language").split("|")
        self.music_num = conf.get("base","music_num")
        self.music_list = conf.get("base","music_list").split("|")
        self.music_start_bool = conf.get("base","music_start_bool")
        self.write_language = conf.get("base", "write_language")
        self.write_language_all = conf.get("base", "write_language_all").split("|")
        self.user_ans = conf.get("write","user_ans").split("|")
        self.truth_ans = conf.get("write","truth_ans").split("|")
        self.aks = conf.get("write", "aks").split("|")


        conl = ConfigParser()

        conl.read("./resources/language/{0}".format(self.exe_language))
        sections = conl.sections()
        for i in sections:
            for j in conl.options(i):
                word_TS[j] = "  " + conl.get(i,j) + "  "
            self.word[i] = word_TS
            word_TS = {}
        print("[system]:language :{0} word:{1}".format(self.exe_language,self.word))
        print("[system]:all read from reader")

    def re_word(self):
        self.__init__()
        return self.word

    def main(self):
        pass

if(__name__ == "__main__"):
    reader().main()

